package com.zhiyou100.HomeWork;

import java.util.Scanner;

public class BubbleSortScore {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
        int [] score = new int[5];
        // 输入成绩部分
        for(int i=0; i<score.length; i++){
            System.out.println("请输入第"+ (i+1) + "名同学的成绩：");
            int s = scr.nextInt();
            score[i] = s;
        }
        // 输出原始成绩
        System.out.print("原始成绩为：");
        for(int i=0; i<score.length; i++){
            System.out.print(score[i] + " ");
        }
        System.out.println();
        for(int i=0; i<score.length-1; i++){
            for (int j=0;j<score.length-1-i;j++){
                int temp;
                if(score[j]<score[j+1]){
                    temp = score[j];
                    score[j] = score[j+1];
                    score[j+1] = temp;
                }
            }
        }
        // 输出排序后的成绩
        System.out.print("降序排列后的成绩为：");
        for(int i=0; i<score.length; i++){
            System.out.print(score[i] + " ");
        }
        System.out.println();
    }
}
